home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15674 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.3 KB  |  69 lines

  1. Path: news.compuserve.com!newsmaster
  2. From: Philippe Verdy <100105.3120@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C++ Read Comma Delimted Text File
  5. Date: 7 Apr 1996 22:56:51 GMT
  6. Organization: CompuServe Incorporated
  7. Message-ID: <4k9h7j$fl9@arl-news-svc-5.compuserve.com>
  8. NNTP-Posting-Host: ad04-110.compuserve.com
  9.  
  10. Steve Farson <75226.1623@CompuServe.COM> s'Θcrit :
  11. > I've never seen or heard of any example showing how to read a 
  12. > comma delimted text file looking something like this:
  13. > ABC,13,12.3,Houston
  14. > DEF,4,11.4,Denver
  15. > EFG,21,14.7,Phoenix
  16. > into variables.  I have a C program doing this, but think there 
  17. > surely is some C++ functions that can help here.  Someone 
  18. > mentioned Getline() once, but every reference I have says nothing 
  19. > about how it would/could be used.  If anyone could provide a 
  20. > snippet or two on how this is done, it would be great.
  21. > Thanks! Steve
  22.  
  23. Coming from Borland C++ 5.0 Help file:
  24. --------------------------------------
  25. istream::get
  26.  
  27. Syntax
  28.  
  29. Form 1  int get();
  30. Form 2  istream& get(char*, int len, char = '\n');
  31.         istream& get(signed char*, int len, char = '\n');
  32.         istream& get(unsigned char*, int len, char = '\n')
  33. Form 3  istream& get(char&);
  34.         istream& get(signed char&);
  35.         istream& get(unsigned char&);
  36. Form 4  istream& get(streambuf&, char = '\n');
  37.  
  38. Description
  39.  
  40. Form 1: Extracts the next character or EOF.
  41. Form 2: Extracts characters into the given char * until the
  42.         delimiter (third parameter) or end-of-file is
  43.         encountered, or until (len - 1) bytes have been read.
  44.         A terminating null is always placed in the output
  45.         string. The delimiter is not extracted from the input
  46.         stream. Fails only if no characters were extracted.
  47. Form 3: Extracts a single character into the given character
  48.         reference.
  49. Form 4: Extracts characters into the given streambuf until
  50.         the delimiter is encountered.
  51. ----------------
  52. istream::ignore
  53.  
  54. Syntax
  55.  
  56. istream& ignore(int n = 1, int delim = EOF);
  57.  
  58. Description
  59.  
  60. The ignore member function causes up to n characters in the
  61. input stream to be skipped; stops if delim is encountered.
  62. The deliminator is extracted from the stream.
  63. -----------------
  64. istream::get(), istream::getline(), and istream::read()
  65. perform unformatted input from the istream.
  66.